# cmake_minimum_required(VERSION 3.10)

# project(gles)

# set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# aux_source_directory(common SRC_LIST_COMMON)
# aux_source_directory(src SRC_LIST_SRC)

# include_directories(common)
# include_directories(/usr/include)
# include_directories(/usr/include/libdrm)
# include_directories(/usr/include/GLES2)
# include_directories(/usr/include/EGL)

# # 查找 OpenGL 包
# set(OPENGL_LIBRARIES /usr/lib/x86_64-linux-gnu/libGLESv2.so)
# set(EGL_LIBRARIES /usr/lib/x86_64-linux-gnu/libEGL.so)
# set(DRM_LIBRARIES /usr/lib/x86_64-linux-gnu/libdrm.so)
# set(GBM_LIBRARIES /usr/lib/x86_64-linux-gnu/libgbm.so)

# set(X11_LIBRARIES /usr/lib/x86_64-linux-gnu/libX11.so)

# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
	
# find_package(Threads REQUIRED)

# add_executable(main ${SRC_LIST_COMMON} ${SRC_LIST_SRC})

# # 链接 OpenGL 库
# target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES} ${EGL_LIBRARIES} ${DRM_LIBRARIES} ${GBM_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )


cmake_minimum_required(VERSION 3.10)

# 项目名称
project(gles)

# 交叉编译工具链路径
set(CMAKE_C_COMPILER aarch64-none-linux-gnu-g++)
set(CMAKE_CXX_COMPILER aarch64-none-linux-gnu-g++)

# 设置目标平台
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin_j6e)

aux_source_directory(common SRC_LIST_COMMON)
aux_source_directory(src SRC_LIST_SRC)

include_directories(common)
include_directories(/home/trn/opt/toolchains/j6e/sysroots/usr/hobot/include)
include_directories(/home/trn/opt/toolchains/j6e/sysroots/usr/hobot/include/gbm)
include_directories(/home/trn/opt/toolchains/j6e/sysroots/usr/hobot/include/libdrm)
include_directories(/home/trn/opt/toolchains/j6e/sysroots/usr/hobot/include/GLES2)
include_directories(/home/trn/opt/toolchains/j6e/sysroots/usr/hobot/include/EGL)

# 设置 CMake 查找库文件时的路径
set(OPENGL_LIBRARIES /home/trn/opt/toolchains/j6e/sysroots/usr/hobot/lib/libGLESv2.so)
set(EGL_LIBRARIES /home/trn/opt/toolchains/j6e/sysroots/usr/hobot/lib/libEGL.so)
set(DRM_LIBRARIES /home/trn/opt/toolchains/j6e/sysroots/usr/hobot/lib/libdrm.so)
set(GBM_LIBRARIES /home/trn/opt/toolchains/j6e/sysroots/usr/hobot/lib/libgbm.so)

# 其他 CMake 配置
# ...

# 添加你的源文件
add_executable(main_j6e ${SRC_LIST_COMMON} ${SRC_LIST_SRC})

# 链接 OpenGL 库
target_link_libraries(main_j6e PRIVATE ${OPENGL_LIBRARIES} ${EGL_LIBRARIES} ${DRM_LIBRARIES} ${GBM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )